package org.particlethink.mapper;


import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.particlethink.handler.ArrayStringTypeHandler;
import org.particlethink.model.Acceptance;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@org.apache.ibatis.annotations.Mapper
public interface AcceptanceMapper extends Mapper<Acceptance> {
    @Results(
        id = "AcceptanceMap",
        value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "create_at", property = "createAt"),
            @Result(column = "arrive_images", property = "arriveImages", typeHandler = ArrayStringTypeHandler.class),
            @Result(column = "images", property = "images", typeHandler = ArrayStringTypeHandler.class),
            @Result(column = "car_number", property = "carNumber"),
            @Result(column = "creator_id", property = "creatorId"),
            @Result(column = "suggestion", property = "suggestion"),
            @Result(column = "deliver_id", property = "deliverId"),
//            @Result(column = "goods_info", property = "goodsInfo", typeHandler = ArrayAcceptanceGoodsInfoTypeHandler.class)
        }
    )
    List<Acceptance> selectByDeliverIds(@Param("deliverIds") List<Integer> deliverIds);

    @Results(
        id = "AcceptanceMap",
        value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "create_at", property = "createAt"),
            @Result(column = "arrive_images", property = "arriveImages", typeHandler = ArrayStringTypeHandler.class),
            @Result(column = "images", property = "images", typeHandler = ArrayStringTypeHandler.class),
            @Result(column = "car_number", property = "carNumber"),
            @Result(column = "creator_id", property = "creatorId"),
            @Result(column = "suggestion", property = "suggestion"),
            @Result(column = "deliver_id", property = "deliverId"),
//            @Result(column = "goods_info", property = "goodsInfo", typeHandler = ArrayAcceptanceGoodsInfoTypeHandler.class)
        }
    )
    List<Acceptance> queryAllByCarNumber(@Param("carNumber") String carNumber);



    List<Acceptance> selectByIds(@Param("ids") List<Integer> ids);

}
